home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr09 / vstsrc.zip / CONSTANT.H < prev    next >
C/C++ Source or Header  |  1995-01-23  |  13KB  |  228 lines

  1. #ifndef _CONSTANT_H
  2. #define _CONSTANT_H
  3. /*
  4.  * %W% %E% %U%  [EXTREL_1.2]
  5.  *
  6.  * VersaTrack orbit calculations are based on those that appear in Dr. Manfred
  7.  * Bester's sattrack program (the Unix(tm) versions 1 and 2).
  8.  *
  9.  * The data from which the maps where generated come from "xsat", an
  10.  * X-Windows program by David A. Curry (N9MSW).
  11.  *
  12.  * Site coordinates come from various sources, including a couple of
  13.  * World Almanacs, and also from both of the programs mentioned above.
  14.  *
  15.  * The following are authors' applicable copyright notices:
  16.  *
  17.  *                                                                               
  18.  * Copyright (c) 1992, 1993, 1994 Manfred Bester. All Rights Reserved.        
  19.  *                                                                           
  20.  * Permission to use, copy, modify, and distribute this software and its      
  21.  * documentation for educational, research and non-profit purposes, without   
  22.  * fee, and without a written agreement is hereby granted, provided that the  
  23.  * above copyright notice and the following three paragraphs appear in all    
  24.  * copies.                                                                    
  25.  *                                                                              
  26.  * Permission to incorporate this software into commercial products may be    
  27.  * obtained from the author, Dr. Manfred Bester, 1636 M. L. King Jr. Way,     
  28.  * Berkeley, CA 94709, USA.                                                   
  29.  *                                                                             
  30.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,  
  31.  * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF    
  32.  * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED   
  33.  * OF THE POSSIBILITY OF SUCH DAMAGE.                                         
  34.  *                                                                             
  35.  * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT       
  36.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A    
  37.  * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"       
  38.  * BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,  
  39.  * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.                                   
  40.  *                                                                             
  41.  *                                                                             
  42.  * Copyright 1992 by David A. Curry                                            
  43.  *                                                                             
  44.  * Permission to use, copy, modify, distribute, and sell this software and its 
  45.  * documentation for any purpose is hereby granted without fee, provided that  
  46.  * the above copyright notice appear in all copies and that both that copyright
  47.  * notice and this permission notice appear in supporting documentation.  The  
  48.  * author makes no representations about the suitability of this software for  
  49.  * any purpose.  It is provided "as is" without express or implied warranty.   
  50.  *                                                                             
  51.  * David A. Curry, N9MSW                                                       
  52.  * Purdue University                                                           
  53.  * Engineering Computer Network                                                
  54.  * 1285 Electrical Engineering Building                                        
  55.  * West Lafayette, IN 47907                                                    
  56.  * davy@ecn.purdue.edu                                                         
  57.  *                                                                             
  58.  * VersaTrack Copyright (c) 1993, 1994 Siamack Navabpour. All Rights Reserved.
  59.  *
  60.  * Permission is hereby granted to copy, modify and distribute VersaTrack
  61.  * in whole, or in part, for educational, non-profit and non-commercial use
  62.  * only, free of charge or obligation, and without agreement, provided that
  63.  * all copyrights and restrictions noted herein are observed and followed, and
  64.  * additionally, that this and all other copyright notices listed herein
  65.  * appear unaltered in all copies and in all derived work.
  66.  *
  67.  * This notice shall not in any way void or supersede any of the other authors
  68.  * rights or privileges.
  69.  *
  70.  * VersaTrack IS PRESENTED FREE AND "AS IS", WITHOUT ANY WARRANTY OR SUPPORT.
  71.  * YOU USE IT AT YOUR OWN RISK. The author(s) shall not be liable for any
  72.  * direct, indirect, incidental, or consequential damage, loss of profits or
  73.  * other tangible or intangible losses or benefits, arising out of or related
  74.  * to its use. VersaTrack carries no warranty, explicit or implied, including
  75.  * but not limited to those of merchantablity and fitness for a particular
  76.  * purpose.
  77.  *
  78.  * Siamack Navabpour, 12342 Hunter's Chase Dr. Apt. 2114, Austin, TX 78729.
  79.  * sia@bga.com or sia@realtime.com.
  80.  */
  81.  
  82.  
  83. /*
  84.  * Elset propagation models
  85.  */
  86. #define TLEMEAN     0
  87. #define NORADSGP4   1
  88. #define NORADSPD4   2
  89.  
  90. #undef  ABS
  91. #define ABS(x)      (((x) < 0) ? (-(x)) : (x) )
  92. #undef  MIN
  93. #define MIN(x,y)    (((x) < (y)) ? (x) : (y))
  94. #undef  MAX
  95. #define MAX(x,y)    (((x) > (y)) ? (x) : (y))
  96. #undef  SQR
  97. #define SQR(x)      ((x)*(x))
  98.  
  99.  
  100. #undef  PI
  101. #define PI                    3.14159265358979323846264338
  102. #undef  TWOPI
  103. #define TWOPI                 (2.0*PI)
  104. #define FOURPI                (4.0*PI)
  105. #define HALFPI                (0.5*PI)
  106. #define THREEHALFPI           (1.5*PI)
  107. #define CRD                   (360.0/TWOPI)        /* change rad into deg     */
  108. #define CDR                   (TWOPI/360.0)        /* change deg into rad     */
  109. #define CRREV                 (1.0/TWOPI)          /* change rad into rev     */
  110. #define EPSILON               (HALFPI/1296000.0)   /* 0.125 arcsec in rad     */
  111. #define MPD                   1440.0               /* minutes per day         */
  112. #define MPD2                  (MPD*MPD)            /* (minutes per day)^2     */
  113. #define MPD3                  (MPD2*MPD)           /* (minutes per day)^3     */
  114. #define SPD                   86400.0              /* seconds per day         */
  115. #define CMKM                  1.0e-3               /* change m to km          */
  116. #define CKMNM                 (1.0/1.852)          /* change km to naut. mil. */
  117. #define CHZKHZ                1.0e-3               /* change Hz to kHz        */
  118. #define CKHZMHZ               1.0e-3               /* change kHz to MHz       */
  119. #define CHZMHZ                1.0e-6               /* change Hz to MHz        */
  120.  
  121. #define EARTHRADIUS           6378.140             /* earth's equatorial radius [km]  */
  122. #define EARTHECCEN            0.01675104           /* Earth's orbit eccentr.  */
  123. #define F                     (1.0/298.257)        /* 0.003352813178  geoid model parameters  */
  124. #define FF                    (F*F)
  125. #define FFF                   (FF*F)
  126. #define F1                    (-F - 0.5*FF)
  127. #define F2                    (0.5*FF + 0.5*FFF)
  128. #define F3                    (-1.0/3.0*FFF)
  129. #define REFF0                 (1.0 - 0.5*F + 5.0/16.0*FF + 5.0/32.0*FFF)
  130. #define REFF1                 (0.5*F - 13.0/64.0*FFF)
  131. #define REFF2                 (-5.0/16.0*FF - 5.0/32.0*FFF)
  132. #define REFF3                 (13.0/64.0*FFF)
  133.  
  134. #define SUNRADIUS             695980.0             /* equatorial radius [km]  */
  135. #define SUNDISKRAD            (16.0*CAMR)          /* Sun disk radius [rad]   */
  136. #define SUNPROX               48.0                 /* Sun prox limit [arcmin] */
  137. #define SUNSEMIMAJORAXIS      149597892.0          /* 1 au [km]               */
  138. #define TWILIGHT              (-6.0*CDR)           /* nautical twilight limit */
  139. #define CVAC                  2.99792458e5         /* speed of light [km/s]   */
  140.  
  141. #define JULCENT               36525.0              /* mean solar days / jcy   */
  142. #define TROPCENT              36524.219879         /* mean solar days / cy    */
  143. #define TROPYEAR              (TROPCENT/100.0)     /* mean solar days / year  */
  144. #define TROPICALYEAR          365.24219879         /* mean solar days / year  */
  145. #define JULDAT1900            2415020.0            /* Julian date of 1900.0   */
  146. #define JULDAT1950            2433282.423          /* Julian date of 1950.0   */
  147. #define JULDAT2000            2451545.0            /* Julian date of 2000.0   */
  148. #define SIDSOLAR              1.002737909350       /* sidereal rotation rate  */
  149. #define SIDRATE               (TWOPI/SPD*SIDSOLAR) /* [rad/s]                 */
  150. #define GM                    398603.2             /* [km^3/s^2]              */
  151. #define GMSGP                 398600.7995          /* value used in SGP model */
  152. #if 0
  153. #define KEPLER                331.254038           /* see below               */
  154. #endif
  155. #define KEPLER                331.25403846464185
  156. #define KEPLERSGP             42241.10831          /* value used in SGP model */
  157.                                                    /* with a [km] and T [min] */
  158.  
  159. /* KEPLER = (GM / (4 PI^2) * 3600)^(1/3) / 1000  with a [km] and T [min]      */
  160.  
  161. #define BEACON                146.0            /* default beacon frequ. [MHz] */
  162. #define MAXPHASE              256              /* max. value for phase number */
  163. #define MAXMODES              10               /* max. number of sat. modes   */
  164.  
  165. #define VLOWELEV              (-20.0*CDR)      /* low elevation level 1 [rad] */
  166. #define LOWELEV               (-4.0*CDR)       /* low elevation level 2 [rad] */
  167. #define MAXELEV               (88.0*CDR)       /* (was 40) max elevation warn limit    */
  168. #define MAXDAYS               2.0              /* limit for rise time search  */
  169.  
  170. /*
  171.  * Some useful constants
  172.  */
  173.  
  174. #define ZERO                  0.0
  175. #define ONEPPB                1.0e-9
  176. #define ONEPPM                1.0e-6
  177. #define TWOPPM                2.0e-6
  178. #define ONETHIRD              (1.0/3.0)
  179. #define TWOTHIRDS             (2.0/3.0)
  180. #define THREEHALFS            (3.0/2.0)
  181. #define ONE                   1.0
  182. #define ONEMEG                1.0e6
  183. #define TWOMEG                2.0e6
  184.  
  185. /*
  186.  * More Unit conversions
  187.  */
  188.  
  189. #define CRH                   (24.0/TWOPI)         /* convert rad into hours  */
  190. #define CRS                   (86400.0/TWOPI)      /* convert rad into sec    */
  191. #define CRD                   (360.0/TWOPI)        /* convert rad into deg    */
  192. #define CRAM                  (21600.0/TWOPI)      /* convert rad into arcmin */
  193. #define CRAS                  (1296000.0/TWOPI)    /* convert rad into arcsec */
  194. #define CDR                   (TWOPI/360.0)        /* convert deg into rad    */
  195. #define CAMR                  (TWOPI/21600.0)      /* convert arcmin into rad */
  196. #define CASR                  (TWOPI/1296000.0)    /* convert arcsec into rad */
  197. #define CRREV                 (1.0/TWOPI)          /* convert rad into rev    */
  198.  
  199. #define HALFDEG               (0.5*CDR)            /* half a deg [rad]        */
  200.  
  201.  
  202. /*
  203.  * Atmospheric parameters used for calculation of refraction
  204.  *  -- Not currently used in VersaTrack. --
  205.  */
  206.  
  207. #define SCALEHEIGHT           8.0              /* atmosph. scale height [km]  */
  208. #define ATMPRESS              760.0            /* standard atm. press. [mmHg] */
  209. #define AMBTEMP               15.0             /* standard amb. temp.  [C]    */
  210. #define RELHUMID              30.0             /* standard rel. humidity [%]  */
  211. #define WAVEL                 0.550            /* wavelength of observ. [um]  */
  212. #define REFWAVEL              0.550            /* reference wavelength [um]   */
  213.  
  214. #define GEOSYNC               1
  215. #define GEOSTAT               2
  216. #define GEOSYNCMOT            0.05             /* maximum deviation in mean   */
  217.                                                /* motion from 1 rev/d for     */
  218.                                                /* geosynchronous satellites   */
  219.  
  220. #define GEOSTATINC            (10.0*CDR)       /* maximum inclination [deg]   */
  221.                                                /* for geostationary sats      */
  222.  
  223. #define SUNUPDATEINT          (15.0/MPD)       /* update interval Sun [d]     */
  224. #define PRECUPDATEINT         (120.0/MPD)      /* update interval precession  */
  225. #define NUTEUPDATEINT         (120.0/MPD)      /* update interval nutation    */
  226.  
  227. #endif /* _CONSTANT_H */
  228.